<!--#include file="config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->

<%

intID=int(Request("id"))
ActionType=request("ActionType")
SaveType=request("SaveType")

'Add
if ActionType="Add" or ActionType="" then
AName="确定增加部门"
URL="?SaveType=AddOK"
end if

'Mod
if ActionType="Mod" and intID<>"" then
AName="确定修改部门"
sql="select * from Emp_Dep where Dep_id="&Intid
rs.open sql,conn,1,1
Brandname=rs("Dep_name")
BrandID=int(rs("Dep_id"))
rs.close
AID=intID
URL="?SaveType=ModOK&ID="&intID
end if

'SaveAdd
if SaveType="AddOK" and request("name")<>"" then
sql="select * from Emp_Dep where Dep_id is null"
rs.open sql,conn,1,3
rs.addnew
rs("Dep_name")=Trim(Request("name"))
rs("Addtime")=now()
rs("AddUser")=session("emp_name")
rs.Update
rs.close
end if

'SaveMod
if SaveType="ModOK" and intID<>"" and request("name")<>"" then
sql="select * from Emp_Dep where Dep_id="&IntID
rs.open sql,conn,1,3
rs("Dep_name")=Trim(Request("name"))
rs.Update
rs.close

end if
%>
<table class="table table-condensed table-hover table-striped table-bordered">
<form method="post" action="<%=URL%>" name="form1">
<tr>
<th>
<input type="text" name="name" value="<%=Brandname%>" size='45'>
<input type="submit" name="Submit" value="<%=aname%>">
<A HREF="?ActionType=Add">[<U><FONT COLOR="#FF0000"><B>增加部门</B></FONT></U>]</A>
&nbsp;</td>
</tr>
</form>
</table>

<%
sql="select * from Emp_Dep order by Dep_id"
rs.open sql,conn,1,1
%>

<table class="table table-condensed table-hover table-striped table-bordered">
<%
for r=1 to rs.recordcount
%>
<tr >
<TD>

[<%=rs("Dep_id")%>]
<A HREF="?ActionType=Mod&ID=<%=rs("Dep_id")%>" title='点击修改<%=rs("Dep_name")%>'><U><%=rs("Dep_name")%></U></A>

</td>
</tr>
<%
rs.moveNext
next
rs.close
%>
</TABLE>

<!--#include file="Footer.asp" -->
